/**
 * @typedef {Object} JoyOptions
 * @property {string} root
 * @property {{[key:string]:any}} data
 * @property {{[key:string]:()=>void}} methods
 */

export class Joy {
  /**
   * @description 根节点
   * @readonly
   * @type {HTMLDivElement}
   */
  rootElement;

  /**
   * @description 虚拟树
   */
  vDom;

  /**
   * @description 构造函数
   * @param {JoyOptions} options
   */
  constructor(options) {
    this.init(options);
  }

  /**
   * @description 初始化
   * @private
   * @param {JoyOptions} options
   */
  init(options) {
    try {
      const rootElement = document.getElementById(options.root);
      if (rootElement === null) {
        throw Error(`not found ${options.root} container.`);
      }
      this.rootElement = rootElement;
      console.log(rootElement.innerHTML);
    } catch (error) {
      if (error.message) {
        console.warn(error.message);
      }
    }
  }
}
